//
//  FunProgressHUD.m
//  BaseModule
//
//  Created by 于鹏 on 2017/8/8.
//  Copyright © 2017年 YIVIEW. All rights reserved.
//

#import "FunProgressHUD.h"
#import "SVProgressHUD.h"

typedef enum {
    HUDTypeSuccess,
    HUDTypeError,
    HUDTypeLoding,
    HUDTypeInfo,
    HUDTypeProgress
} HUDType;

@implementation FunProgressHUD

+ (void)initialize {
    [super initialize];
    [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
    [SVProgressHUD setMinimumDismissTimeInterval:1.5];
    //        [SVProgressHUD setSuccessImage:[UIImage new]];
    //        [SVProgressHUD setErrorImage:[UIImage new]];
}

+ (void)show {
    [SVProgressHUD show];
}

+ (void)dismiss {
    [SVProgressHUD dismiss];
}

+ (void)showSuccessWithStatus:(NSString *)status {
    [self showProgressHUDWithType:HUDTypeSuccess status:status progress:NSNotFound];
}

+ (void)showErrorWithStatus:(NSString *)status {
    [self showProgressHUDWithType:HUDTypeError status:status progress:NSNotFound];
}

+ (void)showInfoWithStatus:(NSString *)status {
    [self showProgressHUDWithType:HUDTypeInfo status:status progress:NSNotFound];
}

+ (void)showLodingWithStatus:(NSString *)status {
    [self showProgressHUDWithType:HUDTypeLoding status:status progress:NSNotFound];
}

+ (void)showProgress:(float)progress status:(NSString*)status {
    [self showProgressHUDWithType:HUDTypeProgress status:status progress:progress];
}

+ (BOOL)isVisible {
    return [SVProgressHUD isVisible];
}
+ (void)showProgressHUDWithType:(HUDType)type status:(NSString *)status progress:(CGFloat)progress {
    switch (type) {
        case HUDTypeSuccess:
            [SVProgressHUD showSuccessWithStatus:status];
            break;
        case HUDTypeError:
            [SVProgressHUD showErrorWithStatus:status];
            break;
        case HUDTypeInfo:
            [SVProgressHUD showInfoWithStatus:status];
            break;
        case HUDTypeProgress:
            [SVProgressHUD showProgress:progress status:status];
            break;
        case HUDTypeLoding:
            [SVProgressHUD showWithStatus:status];
            break;
        default:
            break;
    }
}

@end
